<%--
  Created by IntelliJ IDEA.
  User: 17237
  Date: 2023/10/30
  Time: 0:15
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>添加工程项目</title>
</head>
<body>
<form action="add.project" method="post" enctype="multipart/form-data">
    <p>
        项目名称：<input type="text" required name="projectName" />
    </p>
    <p>
        项目类型：<input type="text" required name="projectCategory" />
    </p>
    <p>
        专家人数：<input type="number" min="0" step="1" required name="professorNum" />
    </p>
    <p>
        项目状态：<input type="text" required name="isEvaluated" />
    </p>
    <p>
        采购方式：<input type="text" required name="prochaseMode" />
    </p>
    <p>
        采购部门id:
        <select id="departmentId" name="departmentId">
        </select>
       <%-- <input type="number" min="1" step="1"  name="departmentId" />--%>
    </p>
    <p>
        预算：<input type="number"  min="0" step="0.01" required name="budget" />
    </p>
    <p>
        采购公告时间：<input type="date"  required name="announceDate" />
    </p>
    <p>
        开标时间：<input type="date" required name="openDate" />
    </p>
    <p>
        开标地点：<input type="text" required name="address" />
    </p>
    <p>
        成交公告时间：<input type="date"  name="dealDate" />
    </p>
    <p>
        公告发布网址：<input type="text"  name="url" />
    </p>
    <p>
        成交单位：<input type="text"  name="dealCompany" />
    </p>
    <p>
        成交价格：<input type="number"  min="0" step="0.01" name="settlePrice" />
    </p>
    <p>
        项目联系人姓名：<input type="text" required name="linkMan" />
    </p>
    <p>
        项目联系人电话：<input type="text" required name="mobliePhone" />
    </p>
    <p>
        项目文件：<input type="file"  accept="*" name="projectFilePath" />
    </p>
    <p>
        创建者：<input type="text" required name="createBy" />
    </p>
    <p>
        创建时间：<input type="date"  name="createDate" />
    </p>
    <p>
        采购部门： <input type="text"  name="department" />

    </p>
    <p>
        修改者：<input type="text"  name="updateBy" />
    </p>
    <p>
        更新时间：<input type="date" required name="updateDate" />
    </p>
    <p>
        报到时间：<input type="date"  name="registerTime" />
    </p>
    <p>
        报到地点：<input type="text"  name="registerAddress" />
    </p>
    <p>
        评标委员会组成人数：<input type="number"  min="0" step="1" name="committee" />
    </p>
    <p>
        采购代表：<input type="text"  name="professional" />
    </p>
    <p>
        完成状态：<input type="number"  min="0" max="1" step="1" name="status" />
    </p>
    <p>
        <input type="submit" value="保存"/>
        <input type="reset" value="重填"/>
    </p>
</form>
<script>
    //页面加载完成
    window.onload=function () {
        var xhr=new XMLHttpRequest();
        xhr.open("get","find.dept",true);//第三个参数，是否是异步
        xhr.send(null);
        console.log("xhr-----",xhr);
        //请求返回
        xhr.onload=function () {
            //console.log("status",xhr.status);
            if(xhr.status==200){
                let res=xhr.responseText;
                //
                let objs=JSON.parse(res);
                //console.log(objs);
                let d=document.getElementById("departmentId");
                for (let i = 0; i < objs.length; i++) {
                    //console.log(objs[i]+"<>><>>?????");
                    //d.innerHTML="<option value='xxx'>yyy</option>";
                    d.appendChild(new Option(objs[i].departmentname,objs[i].id));
                }
            }else{
                alert("请求出错");
            }

        }
    }
</script>
</body>
</html>
